<template>
  <a-row :gutter="5">
    <a-col :span="4">
      <LeftTree @selected="getTreeData" title="审计知识文献" :flag="2"></LeftTree>
    </a-col>
    <a-col :span="20">
      <a-card style="overflow: auto; height: 100%">
        <div class="table-page-search-wrapper">
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
              <a-col :md="6" :sm="8">
                <a-form-item label="作者	">
                  <a-input placeholder="请输入" v-model="queryParam.author"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="8">
                <a-form-item label="标题">
                  <a-input placeholder="请输入" v-model="queryParam.title"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="8">
                <a-form-item label="摘要">
                  <a-input style="width: 100%" v-model="queryParam.summary" />
                </a-form-item>
              </a-col>
              <template v-if="toggleSearchStatus">
                <a-col :md="6" :sm="8">
                  <a-form-item label="出处">
                    <a-input placeholder="请输入" v-model="queryParam.source"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :md="6" :sm="8">
                  <a-form-item label="所属单位">
                    <j-select-depart
                      v-model="queryParam.remid"
                      :trigger-change="true"
                      customReturnField="id"
                      :multi="true"
                    ></j-select-depart>
                  </a-form-item>
                </a-col>
              </template>
              <a-col :md="6" :sm="8">
                <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                  <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                  <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px"
                    >清除条件</a-button
                  >
                  <a @click="handleToggleSearch" style="margin-left: 8px">
                    {{ toggleSearchStatus ? '收起' : '展开' }}
                    <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
                  </a>
                </span>
              </a-col>
            </a-row>
          </a-form>
        </div>
        <!-- table区域-begin -->
        <div>
          <!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
          <!--        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{-->
          <!--        selectedRowKeys.length }}</a>项-->
          <!--        <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
          <!--      </div>-->

          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            @change="handleTableChange"
          >
            <span slot="title2" slot-scope="text">
              <j-ellipsis :value="text" :length="20" />
            </span>
            <span slot="summary" slot-scope="text">
              <j-ellipsis :value="text" :length="30" />
            </span>
            <span slot="author" slot-scope="text">
              <j-ellipsis :value="text" :length="10" />
            </span>
            <span slot="actionName">
              <a-button size="small" @click="handleAdd('审计知识文献-新增')" type="primary" icon="plus">新增</a-button>
            </span>
            <span slot="action" slot-scope="text, record">
              <a @click="handleCheck(record, '审计知识文献-查看')">查看</a>
              <a-divider type="vertical" />
              <a-dropdown>
                <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
                <a-menu slot="overlay">
                  <a-menu-item>
                    <a @click="handleEdit(record, '审计知识文献-编辑')">编辑</a>
                  </a-menu-item>
                  <a-menu-item>
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
            </span>
          </a-table>
        </div>
        <!-- table区域-end -->
        <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
      </a-card>
    </a-col>
  </a-row>
</template>
<script>
// 表头
import LeftTree from '../../components/LeftTree'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CheckAndEditModel from './CheckAndEditModel'
import JEditor from '@/components/jeecg/JEditor'
import columns from './indexColumns'

export default {
  name: '审计知识文献',
  mixins: [JeecgListMixin],
  components: {
    LeftTree,
    CheckAndEditModel,
    JEditor,
  },
  data() {
    return {
      queryParam: {},
      superParam: {
        advType: '2',
        cate: '',
      },
      // 表头
      columns: columns(this),
      url: {
        list: '/sjzszhly/sjKnowledgeLiterature/literatureList',
        delete: '/sjzszhly/sjKnowledgeLiterature/delete',
      },
    }
  },
  computed: {},
  methods: {
    getTreeData(data) {
      this.superParam.cate = data.id
      this.loadData(1)
    },
  },
  created() {},
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
<style lang="less" scoped>
.ant-row {
  height: 100%;

  .ant-col {
    height: 100%;

    .ant-card {
      height: 100%;

      /deep/ .ant-card-body {
        padding: 15px;
      }
    }
  }
}
</style>